package durst.def.calendar;

import java.sql.SQLException;
import java.util.UUID;

import durst.data.Account;
import durst.data.UserCalendar;
import durst.data.dao.TestDaoFactory;
import durst.def.DefaultData;

public class DefaultAccount extends Account implements DefaultData<Account> {
	public DefaultAccount() {
	}

	@Override
	public Account create(boolean persist) throws SQLException {
		Account ret = new Account(UUID.randomUUID().toString().replace("-", ""), UUID.randomUUID()
				.toString().replace("-", ""), UUID.randomUUID().toString(), UUID.randomUUID()
				.toString().substring(0, 8), UUID.randomUUID().toString().substring(0, 8),
				(UserCalendar) new DefaultUserCalendar().create(persist));
		
		if (persist) {
			TestDaoFactory.createDao(Account.class).create(ret);
		}
		
		return ret; 
	}
}
